package com.sprouting.personal.model.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.sprouting.personal.annotations.CheckLength;
import com.sprouting.personal.annotations.CheckNotNull;
import com.sprouting.personal.model.common.BaseModel;
import com.sprouting.personal.model.common.jsr.AddGroup;
import com.sprouting.personal.model.common.jsr.UpdGroup;
import lombok.Data;

import javax.validation.constraints.Null;

/**
 * 字典组
 *
 * @author ：LX（长沙麓谷）
 * @date 创建时间： 2022/7/29 8:29
 */
@TableName("ps_dict_group")
@Data
public class DictGroup extends BaseModel {

    /**
     * 主键
     */
    @TableId
    @CheckNotNull(message = "非法ID", groups = UpdGroup.class)
    @Null(message = "无效ID", groups = AddGroup.class)
    private String id;
    /**
     * 字典组代码-有且唯一，一组数字字符串
     * @see com.sprouting.personal.interfaces.common.Constant.RetainDictGroup 保留字典组代码
     */
    @CheckLength(min = 1, max = 20, message = "字典组代码超过长度限制")
    @CheckNotNull(message = "请输入字典组代码")
    private String code;
    /**
     * 用户ID ，默认用户ID为 {@link com.sprouting.personal.interfaces.common.Constant.DefaultValue#STRING}，则为公共字典
     * 其他有值的则都为非基础数据
     * @see User#getId()
     */
    @CheckNotNull(message = "请选择所属用户", groups = UpdGroup.class)
    private String userId;
    /**
     * 字典组名称
     */
    @CheckLength(min = 1, max = 40, message = "字典组名称超过长度限制")
    @CheckNotNull(message = "请输入字典组名称")
    private String name;
    /**
     * 字典组描述
     */
    @CheckLength(min = 1, max = 100, message = "字典组描述超过长度限制")
    @CheckNotNull(message = "请输入字典组描述")
    private String describe;
    /**
     * 是否基础数据
     * @see com.sprouting.personal.interfaces.common.Constant.BaseData
     */
    private Integer baseData;
    /**
     * 排序,默认99
     * @see com.sprouting.personal.interfaces.common.Constant.DefaultValue#SORT
     */
    private Double sort;

}
